import 'package:flutter/material.dart';
import 'package:transparent_image/transparent_image.dart';
import 'package:cached_network_image/cached_network_image.dart';

class WebImageDemo extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    var title = 'Web Images';
    final String imageUrl =
        'https://i0.hdslb.com/bfs/article/cebc208e6eea2290e40c7a9dd66a82f4e8447557.png@1320w_2346h.webp';
    return new Scaffold(
      appBar: new AppBar(
        title: new Text(title),
      ),
      body: new ListView(
        children: <Widget>[
          new Image(
            image: new CachedNetworkImageProvider(imageUrl),
          ),
          new Image.network(imageUrl),
          new FadeInImage.memoryNetwork(
              placeholder: kTransparentImage, image: imageUrl),
          CachedNetworkImage(
            placeholder: (context, url) => new CircularProgressIndicator(),
            imageUrl: imageUrl,
            errorWidget: (context, url, error) => new Icon(Icons.error),
          ),
        ],
      ),
    );
  }
}
